{{ $page_rel := .Page.RelPermalink | safeURL }}
{{ $page_rel_trim := strings.TrimLeft "/" $page_rel | safeURL }}
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  {{ .Site.Params.version_menu }}
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
  {{ range .Site.Params.versions }}
    {{ $ver := .version }}
      <a class="dropdown-item" href="{{ .url }}{{ if eq $ver "develop" }}{{ $page_rel_trim }}{{ else }}{{ $page_rel }}{{ end }}">{{ $ver }}</a>
  {{ end }}
</div>
